/*
 * @lc app=leetcode.cn id=290 lang=javascript
 *
 * [290] 单词规律
 */

// @lc code=start
/**
 * @param {string} pattern
 * @param {string} s
 * @return {boolean}
 */
var wordPattern = function(pattern, s) {
    pattern=pattern.split("")
    s=s.split(" ")
    if(s.length!=pattern.length)return false
    for(let i=0;i<s.length-1;i++){
        for(let j=i+1;j<s.length;j++){
            if((s[i]==s[j]&&pattern[i]!=pattern[j])||(s[i]!=s[j]&&pattern[i]==pattern[j])){return false}
        }
    }
    return true
};
// @lc code=end

